cmake_minimum_required( VERSION 2.8 )
project(sift_slam)


set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}  -Wall  -O3  ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall   -O3 ")

set( CMAKE_CXX_FLAGS "-std=c++14" )

set(CMAKE_C_FLAGS "-pthread -std=gnu99")
set(CMAKE_EXE_LINKER_FLAGS "-pthread")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")


find_package( OpenCV 3 REQUIRED )
find_package(Eigen3 REQUIRED NO_MODULE)
find_package(Pangolin REQUIRED)

include_directories(
	${PROJECT_SOURCE_DIR}
	${PROJECT_SOURCE_DIR}/src
  	${OpenCV_INCLUDE_DIRS}
	${EIGEN3_INCLUDE_DIR}
	${Pangolin_INCLUDE_DIRS}
  )

add_executable( sift_slam  	src/main.cpp
							src/Frame.cpp
							src/MapPoint.cpp
							src/KeyFrame.cpp
							src/Map.cpp
							src/Converter.cpp
							src/LocalMapping.cpp
							src/Tracking.cpp
							src/MapDrawer.cpp
							src/Viewer.cpp)


target_link_libraries( sift_slam  	${OpenCV_LIBS}
									${EIGEN3_LIBS}
									${Pangolin_LIBRARIES}
									${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so)


#frame test
add_executable( frame_test 	src/frame_test.cpp
							src/Frame.cpp
							src/MapPoint.cpp
							src/KeyFrame.cpp
							src/Map.cpp
							src/Converter.cpp
							src/LocalMapping.cpp)
target_link_libraries( frame_test 	${OpenCV_LIBS}
									${EIGEN3_LIBS}
									${Pangolin_LIBRARIES}
									${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so)

#track frame test
add_executable( track_frame_test 	src/track_frame_test.cpp
									src/Frame.cpp
									src/MapPoint.cpp
									src/KeyFrame.cpp
									src/Map.cpp
									src/Converter.cpp)

target_link_libraries( track_frame_test ${OpenCV_LIBS}
										${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so)

#track frame test
add_executable( g2o_test 	src/g2o_test.cpp
									src/Frame.cpp
									src/MapPoint.cpp
									src/KeyFrame.cpp
									src/Map.cpp
									src/Converter.cpp)

target_link_libraries( g2o_test ${OpenCV_LIBS}
										${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so)


#test PoseOptimization_test
add_executable(PoseOptimization_test 	src/PoseOptimization_test.cpp
										src/Converter.cpp)

target_link_libraries(PoseOptimization_test ${OpenCV_LIBS}
										${PROJECT_SOURCE_DIR}/g2o/lib/libg2o.so)

